package com.miage.forum.session;

import java.util.List;

import com.miage.forum.entities.Categorie;
import com.miage.forum.entities.Message;
import javax.ejb.*;
import javax.persistence.*;

@Stateless
public class gestionMessageBean implements gestionMessage {
	@PersistenceContext
	EntityManager em;
	
	@Override
	public void ajouter(Message message) {
		em.persist(message);

	}

	@Override
	public List<Message> lister() {
		return em.createQuery("select ms from Message  ms").getResultList();
	}

	@Override
	public Message rechercher(int idMessage) {
		return em.find(Message.class, idMessage);
	}

}
